/**
 * @param {string} command
 * @return {string}
 */
export var interpret = function (command) {
  let ans = ''
  let i = 0
  while (i < command.length) {
    const c = command[i]
    if (c === 'G') {
      ans += 'G'
      i++
      continue
    }
    if (c === 'a') {
      ans += 'al'
      i += 3
      continue
    }
    if (c === '(' && command[i + 1] === ')') {
      ans += 'o'
      i += 2
      continue
    }
    i++
  }
  return ans
}

/**
 * 字符串替换
 * @param {string} command
 * @return {string}
 */
export var interpret2 = function (command) {
  return command.replace(/\(\)/g, 'o').replace(/\(al\)/g, 'al')
}
